package com.kili.file.utils;

import com.google.common.base.Preconditions;
import com.kili.file.enums.FileStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Gordon
 * @version 2019/3/30
 */
@Slf4j
public final class CommonValidKit {

    /**
     * This method is used as a universal check and
     * can be used for image server to perform unified check.
     *
     * @param file
     */
    public static void unifiedVerificationProcessor(MultipartFile file) {
        Preconditions.checkArgument(
                FileStatus.isLegal(FileUtil.validFile(file)),
                "The file Type valid processor is illegal");
    }

}
